export interface IEnum {
  code: string;
  value: string;
}

export function formatEnumForSelect(enumData: any, screenArr?: any) {
  let enumDataKeysArr = Object.keys(enumData);
  if (screenArr) {
    enumDataKeysArr = Object.keys(enumData).filter((item: any) => screenArr.includes(item));
  }
  return enumDataKeysArr.map((key: any) => {
    return {
      label: enumData[key].value,
      value: enumData[key].code,
    };
  });
}
interface IResourceFileType {
  osgb: IEnum;
  shp: IEnum;
  kml: IEnum;
  json: IEnum;
  '3dtiles': IEnum;
  '3ds': IEnum;
  gltf: IEnum;
  'tif-dem': IEnum;
  'tif-dom': IEnum;
  jlg: IEnum;
  terrain: IEnum;
  img: IEnum;
  'stp-step': IEnum;
  dxf: IEnum;
  obj: IEnum;
  fbx: IEnum;
  dgn: IEnum;
  skp: IEnum;
  las: IEnum;
  '3dxml': IEnum;
  '3dm': IEnum;
  ifc: IEnum;
  nwd: IEnum;
  rvt: IEnum;
}
// 实景三维-OSGB、矢量数据-SHP、矢量数据-KML、矢量数据-GeoJson、人工模型-3DTILES、人工模型-3DS、人工模型-GLTF、影像数据-TIF、地形数据-TIF
export const ResourceFileType: IResourceFileType = {
  osgb: { code: 'osgb', value: '实景三维-OSGB' },
  shp: { code: 'shp', value: '矢量数据-SHP' },
  kml: { code: 'kml', value: '矢量数据-KML' },
  json: { code: 'json', value: '矢量数据-GeoJson' },
  '3dtiles': { code: '3dtiles', value: '人工模型-3DTILES' },
  '3ds': { code: '3ds', value: '人工模型-3DS' },
  gltf: { code: 'gltf', value: '人工模型-GLTF/GLB' },
  jlg: { code: 'jlg', value: '人工模型-JLG' },
  'tif-dom': { code: 'tif-dom', value: '影像数据-TIF' },
  'tif-dem': { code: 'tif-dem', value: '地形数据-TIF' },
  terrain: { code: 'terrain', value: '地形数据-terrain' },
  img: {
    code: 'img',
    value: '图片数据-JPG/JPEG/PNG/BMP/SVG/ICO',
  },
  'stp-step': {
    code: 'stp-step',
    value: '人工模型-STP/STEP',
  },
  dxf: {
    code: 'dxf',
    value: '人工模型-DXF',
  },
  obj: {
    code: 'obj',
    value: '人工模型-OBJ',
  },
  fbx: {
    code: 'fbx',
    value: '人工模型-FBX',
  },
  dgn: {
    code: 'dgn',
    value: '人工模型-DGN',
  },
  skp: {
    code: 'skp',
    value: '人工模型-SKP',
  },
  las: {
    code: 'las',
    value: '人工模型-LAS/LAZ',
  },
  '3dxml': {
    code: '3dxml',
    value: '人工模型-3DXML',
  },
  '3dm': {
    code: '3dm',
    value: '人工模型-3DM',
  },
  ifc: {
    code: 'ifc',
    value: '人工模型-IFC',
  },
  nwd: {
    code: 'nwd',
    value: '人工模型-NWD',
  },
  rvt: {
    code: 'rvt',
    value: '人工模型-RVT',
  },
};

// 位置、平移、旋转范围校验
export const ValidateRule: any = {
  position: {
    0: {
      min: -180,
      max: 180,
      message: '',
    },
    1: {
      min: -90,
      max: 90,
      message: '',
    },
    2: {
      min: undefined,
      max: undefined,
      message: '',
    },
  },
  // translation: {
  //   0: {
  //     min: -180,
  //     max: 180,
  //     message: '',
  //   },
  //   1: {
  //     min: -90,
  //     max: 90,
  //     message: '',
  //   },
  //   2: {
  //     min: undefined,
  //     max: undefined,
  //     message: '',
  //   },
  // },
  // offset: {
  //   0: {
  //     min: -180,
  //     max: 180,
  //     message: '',
  //   },
  //   1: {
  //     min: -90,
  //     max: 90,
  //     message: '',
  //   },
  //   2: {
  //     min: undefined,
  //     max: undefined,
  //     message: '',
  //   },
  // },
  rotation: {
    0: {
      min: -359.99,
      max: 359.99,
      message: '',
    },
    1: {
      min: -359.99,
      max: 359.99,
      message: '',
    },
    2: {
      min: -359.99,
      max: 359.99,
      message: '',
    },
  },
};

// 分页器配置
export const PaginationLayout = 'prev, pager, next, sizes, jumper';

// 图片类型
export const ImageMIMETypes = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp'];

// 支持上传文件格式
export const updatedFileFormat: string[] = [
  'osgb',
  'shp',
  'kml',
  'json',
  'geojson',
  'gltf',
  'jlg',
  'zip',
  'glf',
  'terrain',
  'img',
  'stp',
  'step',
  'dxf',
  'obj',
  'fbx',
  'dgn',
  'skp',
  '3ds',
  'las',
  '3dxml',
  '3dm',
  'ifc',
  'glb',
  'tif',
  'nwd',
  'rvt',
];
// 支持上传图片格式
export const updatedImgFormat: string[] = ['jpg', 'jpeg', 'png', 'bmp', 'svg', 'ico'];
